<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<!doctype html>

<html lang="ru-RU">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>
        <c:set var="title"><tiles:getAsString name="title"/></c:set>
        <spring:message code="${title}"/>
    </title>

    <link rel="stylesheet" type="text/css" href="/resources/css/base.css"/>
    <spring:theme code="styleSheet" var="appCss"/>
    <spring:url value="${appCss}" var="appCssUrl"/>
    <link rel="stylesheet" type="text/css" media="screen" href="${appCssUrl}"/>
    <%--To avoid any flash of unstyled content due to delays in CSS downloading, you should always include the theme's CSS file before loading dojo.js.--%>
    <%--<link rel="stylesheet" type="text/css" href="/resources/script/lib/dijit/themes/soria/soria.css">--%>

    <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <%--dojo--%>
    <script type="text/javascript">
        var dojoConfig = {
            async: true,
            parseOnLoad:true,
            baseUrl: "/resources/script/",
            tlmSiblingOfDojo: false,
            packages: [
                { name: "dojo", location: "lib/dojo" },
                { name: "dijit", location: "lib/dijit" },
                { name: "dojox", location: "lib/dojox" },
                { name: "widget", location: "widget", main: "app" }
            ]
        };
    </script>
    <script src="/resources/script/lib/dojo/dojo.js"></script>
    <script type="text/javascript">
        // load requirements for declarative widgets in page content
        require(["dojo/parser", "dojo/domReady!"]);
    </script>
</head>
<body <%--class="soria"--%>>
    <sec:authorize access="isAuthenticated()" var="isAuthenticated"/>

    <div id="wrapper">

        <header id="header">
            <tiles:insertAttribute name="header"/>
        </header>

        <section id="container">

            <aside id="left">
                <tiles:insertAttribute name="left"/>
            </aside>

            <div id="content">
                <%--@elvariable id="serverMessage" type="com.realtyreg.webview.message.ServerMessage"--%>
                <c:if test="${not empty serverMessage}">
                    <div class="${serverMessage.type}">${serverMessage.text}</div>
                </c:if>
                <tiles:insertAttribute name="content"/>
            </div>

            <c:if test="${isAuthenticated}">
                <aside id="right">
                    <tiles:insertAttribute name="right"/>
                </aside>
            </c:if>
        </section>

        <footer id="footer">
            <tiles:insertAttribute name="footer"/>
        </footer>

    </div>

</body>
</html>